<?php
mysql_query ("CREATE TABLE IF NOT EXISTS setting (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`newspage` int(3) NOT NULL default '10',
`userpage` INT(3)  NOT NULL  default '10',
`prepnewsmain` INT(3)  NOT NULL  default '5' ,
`newsmain` INT(3)  NOT NULL  default '5' ,
`messpage` INT(3)  NOT NULL  default '10' ,
`templates` VARCHAR( 15 )  NOT NULL  default '2' ,
`patch_avatar` VARCHAR( 15 )  NOT NULL  default 'avatar/' ,
`mailname` VARCHAR( 100 )  NOT NULL  default 'ЕТК ВГТУ' ,
`adminmail` VARCHAR( 100 )  NOT NULL  default 'boom.vrn@gmail.com' 
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;") or die(mysql_error());
$vsego2 = mysql_query("SELECT COUNT(*) FROM setting");
list($vsego) = mysql_fetch_row($vsego2);
if  ($vsego<1) {mysql_query ("INSERT INTO setting VALUES (0,10,10,5,5,10,2,'avatar/','ЕТК ВГТУ','boom.vrn@gmail.com')") or die(mysql_error());}
$setres = mysql_query("SELECT * FROM setting") or die(mysql_error()); //извлекаем из базы все данные о пользователе
$setting = mysql_fetch_array($setres);
global $newspage,$userpage,$newsmain,$templates,$path_avatar,$adminmail;
$newspage=$setting['newspage'];
$userpage=$setting['userpage'];
$messpage=$setting['messpage'];
$prepnewsmain=$setting['prepnewsmain'];
$newsmain=$setting['newsmain'];
$templates=$setting['templates'];
$patch_avatar=$setting['patch_avatar'];
$mailname=$setting['mailname'];
$adminmail=$setting['adminmail'];
?>